package com.xuwei.ext.js;

import javax.script.ScriptEngine;
import javax.script.ScriptEngineManager;

public class HelloScript {
	public static void main(String[] args) throws Exception {
		/*1、创建一个ScriptEngineManager对象
		2、通过ScriptEngineManager获得ScriptEngine对象
		3、用ScriptEngine的eval方法执行脚本*/
		ScriptEngineManager factory = new ScriptEngineManager();
		ScriptEngine engine = factory.getEngineByName("JavaScript");
		engine.eval("print('Hello, Scripting')");
	}
}